package cn.com.git.oauth.client.ctrler;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhangzhenfu
 * @Description
 * @date 2020/4/21 17:38
 */
@Controller
public class GlobalCtrler {

    @RequestMapping({"","/","/index"})
    @ResponseBody
    public String index(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return "hello client index "+(authentication.getPrincipal()==null?"":",hello "+authentication.getName());
    }

}
